﻿using NetworkLib.Utilities;
using PBO.Network.Enumerations;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace PBO.Network
{
    public class TieMessageRequest : DataByteArray
    {
        public string identity { get; set; }
        public TieMessage message { get; set; }

        public override void Read(ByteArray byteArray)
        {
            this.identity = byteArray.ReadUTF();
            this.message = (TieMessage)byteArray.ReadInt();
        }

        public override void Write(ByteArray byteArray)
        {
            byteArray.WriteUTF(this.identity);
            byteArray.WriteInt((int)this.message);
        }
    }

    public class LogonResponse : DataByteArray
    {
        public string identity { get; set; }
        public BattleMode modeInfo { get; set; }
        public string versionInfo { get; set; }

        public override void Read(ByteArray byteArray)
        {
            this.identity = byteArray.ReadUTF();
            this.modeInfo = (BattleMode)byteArray.ReadInt();
            this.versionInfo = byteArray.ReadUTF();
        }

        public override void Write(ByteArray byteArray)
        {
            byteArray.WriteUTF(this.identity);
            byteArray.WriteInt((int)this.modeInfo);
            byteArray.WriteUTF(this.versionInfo);
        }
    }

    public class PositionResponse : DataByteArray
    {
        public byte position { get; set; }
        public string player { get; set; }

        public override void Read(ByteArray byteArray)
        {
            this.position = byteArray.ReadByte();
            this.player = byteArray.ReadUTF();
        }

        public override void Write(ByteArray byteArray)
        {
            byteArray.WriteByte(this.position);
            byteArray.WriteUTF(this.player);
        }
    }
}
